package org.ll.demo25;

import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/response")
public class ResponseController {
    //    @ResponseBody
    @RequestMapping("/returnPage")
    public String returnPage() {
//        List<Integer> list = List.of(1,2,3);
        return "/index.html";
    }
    @ResponseBody
    @RequestMapping("/returnHtml")
    public String returnHtml(){
        return "<h1>我是一级标题</h1>";
    }
    @ResponseBody
    @RequestMapping("/Json")
    public Person returnJson(){
        return new Person("zhangsan",1,1);
    }

    @RequestMapping(value = "/setStatus")
    @ResponseBody
    public String setStatus(HttpServletResponse response) {
        response.setStatus(401);
        return " 设置状态码成功 ";
    }
}
